package dadonas.xmlpersistence;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
*
* Contains the basic attributes of an element or attribute. 
* 
* @author dadonas
* 
* @since 2011
* 
*/

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface XMLPersistenceField{
	
	/**
	 * 
	 * Tag or Attribute name. <br />
	 * If is not set, the name of class' property is assumed as the name of the tag.
	 */
	public String name() default "";
	
	/**
	 * 
	 * Set true if it is an attribute to appear inside the parent tag.<br />
	 * Default value is false.
	 */
	public boolean isAttibute() default false;
	
	/**
	 * 
	 * The minimum occurences of this tag in the XML. <br />
	 * If the value is set to zero and the property value is null or empty, the tag doesn't appear in XML. <br />
	 * If the value is more then zero and the property value is null, then tag appear empty.<br />
	 * Default value is 1. 
	 */
	public int minOccurs() default 0;
	
	/**
	 * 
	 * The maximum occurences of this tag in the XML. <br />
	 * If the number of occurences exceeds the maximum, an exception is raised.<br />
	 * Default value is 0. 
	 */
	public int maxOccurs() default 1;
	
	/**
	 * 
	 * The default value is used if the property is not set.
	 */
	public String defaultValue() default "";
	
	/**
	 * 
	 * The field order that the tag is gonna be inserted in the XML.
	 */
	public int order();
	
}
